home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / asm / lass.com / LASS-2.MAN < prev    next >
Encoding:
Text File  |  1989-09-07  |  16.0 KB  |  374 lines

  1. .N:21
  2. .F:
  3. .F:...Page $$$...
  4.  
  5.                            Chapter  VII
  6.                           Error Messages
  7.  
  8.      Some  of  these  messages  will occur only during Pass Two, 
  9. others repeat, occurring during each pass.  In either case, LASS 
  10. gives you the opportunity to rewrite the line and  continue  the 
  11. assembly.  However  this  only  corrects  the  object code being 
  12. assembled.  You must keep notes, and later go back to the source 
  13. file to make the corrections there.  Note that if the  line  you 
  14. are correcting starts with a label you should rewrite it without 
  15. the label.  Since the label has already been listed in the label 
  16. array  and  counted,  a  repeat  of  the label will only produce 
  17. another error message.  
  18.  
  19.      If your final program fails to run properly  and  you  find 
  20. that a line of code has been completely omitted check to be sure 
  21. that the previous code line ends with a carriage return and line 
  22. feed (0D 0A) or at least one of the two.  This error is unlikely 
  23. but  I  have  known it to happen.  It is also possible to kill a 
  24. line by putting code on the same line with a  label  and  colon.  
  25. See LABELS in Chapter IV.  
  26.  
  27.      There  is  one  error  in LASS that I have not been able to 
  28. track down.  Twice I have gotten the  error  message  "jump  too 
  29. far"  with a line number but no code line.  Single stepping with 
  30. Debug caused  the  line  to  display  correctly  and  any  trial 
  31. thereafter  failed to repeat the error.  If this happens to you, 
  32. you will have to find the source line by the line number  alone.  
  33. See Jump too far below.  
  34.  
  35.      If  the  screen suddenly fills with garbage there is an end 
  36. of file marker missing.  See Chapter III, End of File.  
  37.  
  38. Messages:
  39.  
  40. Assuming word for missing B or W
  41.  
  42.      There is no B or W  at  the  end  of  the  op  mnemonic  to 
  43.      identify the pointer operand.  For a byte pointer,  rewrite 
  44.      the line,  adding B.  If you do not rewrite the line,  word 
  45.      pointer will be assumed.  For instance: 
  46.  
  47.      mov   [Data_Byte],04     change to     movB  [Data_Byte],04
  48.  
  49. Byte address already at nnnn 
  50.  
  51.      An  ORG  statement  contained  an  offset address which has 
  52.      already been passed by the object code.  To recover, change 
  53.      the address to be equal or greater to the byte address.  
  54.  
  55. Duplicate label
  56.  
  57.      This label has been used previously.  Rewrite line, using a 
  58.      different name, if you wish to continue.  Remember that all 
  59.      referances to the duplicate name will be translated to  the 
  60.      address of the first occurrence,  so you will have to check 
  61.      your source code to correct those operands.  
  62.  
  63. File not found. Press Return when ready for retry.
  64.  
  65.      Your source file was not found on the disk  you  specified.  
  66.      Change the disk and press enter; the program will continue.  
  67.      If  you  made  an error in specifying the disk drive or the 
  68.      filename,  break (press ctrl key and scroll lock  key)  and 
  69.      start  over.  This would only happen before Lass started to 
  70.      assemble any code, so little time is wasted.  
  71.  
  72. Final quote mark missing
  73.  
  74.      No final ' was found at the end of a string or single ascii 
  75.      character.  The best thing to do is to  rewrite  the  line, 
  76.      otherwise  spaces and comment bytes will be included in the 
  77.      byte count and in the object code.   
  78.  
  79. Invalid displacement
  80.  
  81.      Something is wrong with the displacement  number  within  a 
  82.      pointer.  Check the size of the number.  Remember that just 
  83.      one displacement is permitted, not [BX+Label+04].  
  84.  
  85. Invalid number
  86.  
  87.      A  number  was  assumed  because  the  item  started with a 
  88.      decimal digit.  Perhaps a number without an 'H' at the  end 
  89.      had a letter digit.  It is also possible that a number that 
  90.      should  follow the op code is entirely missing.  RET may be 
  91.      guilty if no semi-colon precedes a comment: 
  92.  
  93.      RET              LASS tries to make a number of these words
  94.  
  95. JMPS would do
  96.  
  97.      A jump is within the one byte limit, but since a short jump 
  98.      was not specified,  it has been assembled into the  3  byte 
  99.      jmp  code  rather  than the 2 byte code for jmps.  The line 
  100.      cannot be rewritten during assembly, but you can later make 
  101.      the change in the source code and reassemble if  you  wish.  
  102.      Or just leave it as is.  
  103.  
  104. Jump too far
  105.  
  106.      A conditional jump or loop is beyond the range of one byte.  
  107.      If you ignore the line,  there will be continuing errors at 
  108.      every line starting with a  label,  because  2  bytes  were 
  109.      counted  for the jump in Pass One.  The best thing to do is 
  110.      to rewrite the line, replacing the address.  
  111.  
  112.      JZ   Other_Place        change to        JZ    $+0
  113.  
  114.      After this assembly is finished, rewrite the source code to 
  115.      correct the error and reassemble.  
  116.  
  117.      JZ   Other_Place        change to        JNZ   $+3
  118.                                               JMP   Other_Place
  119.  
  120. Label address revised
  121.  
  122.      This is a Pass Two error.  The byte count made during  Pass 
  123.      One  turned  out  to  be  incorrect.  A  line may have been 
  124.      rewritten during one pass but not the other, or a duplicate 
  125.      label error may have produced a miscount.  There is no  way 
  126.      to  recover  from  this  problem,  except to go back to the 
  127.      source code now and make the needed corrections.  
  128.  
  129. No label for EQU statement
  130.  
  131.      Without a label,  the value given by the EQU statement  can 
  132.      never  be used.  Rewrite,  this time labeling the line.  If 
  133.      there was a label but you mistakenly put it on the previous 
  134.      line,  you must use a different label now or you will get a 
  135.      duplicate  label  error  message  for your pains.  Make the 
  136.      proper correction after assembly in the source file.  
  137.         
  138. Number too large
  139.  
  140.      Remember the limits:  255 or 0FFh for a byte
  141.                            35,535 or 0FFFFh for a word
  142.      For a displacement:   -17,768 to 17,767
  143.                      or:   7FFFh
  144.  
  145. Operand Missing
  146.  
  147.      The op code requires one or more operands and one (or more) 
  148.      is missing.  This message will also appear if  there  is  a 
  149.      space between the first operand and its comma.  
  150.  
  151. Sorry, but there was a file access error. Back to DOS
  152.  
  153.      An error in writing to a file or in creating a file is  the 
  154.      most  likely  cause  of  this error.  If it occurs the only 
  155.      thing to do is to start over, making sure no disk is moved, 
  156.      or drive door opened once  the  program  has  started.  The 
  157.      only  exception  is a disk change called for by the Llinker 
  158.      file.  
  159.  
  160. Syntax error
  161.  
  162.      There are  a  number  of  ways  of  producing  this  error.  
  163.      Perhaps  too many operands were used,  or there was a comma 
  164.      at the end of a DB series but no following number.  Did you 
  165.      try to use a segment register where it is not  permitted  ?  
  166.      Or  use  an  immediate  number  with an XCHG ?  Perhaps the 
  167.      register was mispelled where only CL or DX is accepted,  or 
  168.      a  shift or rotate was called for more than 1 time (but not 
  169.      CL).  Perhaps a single register was  mixed  with  a  double 
  170.      register, or you tried to PUSH a single register.  
  171.  
  172. Unknown Label
  173.  
  174.      A  label  found  in  an operand has not been used to mark a 
  175.      code line.  Rewrite the line,  correcting a misspelling  if 
  176.      that  is  the  problem,  or  entering  a  known label or an 
  177.  
  178.      immediate number.  A hexadecimal  number  starting  with  a 
  179.      letter  digit  could  also  produce  this  message.  if so, 
  180.      rewrite, inserting the missing zero.  However, replacing an 
  181.      expected 2 byte label with a 1 byte  number  will  cause  a 
  182.      miscount and a fatal label address revised error.  Make a 2 
  183.      byte number of it if you wish to continue the assembly.  
  184.  
  185. Unknown op code
  186.  
  187.      Either  it is a code Lass does not accept,  or the mnemonic 
  188.      is misspelled.  Perhaps a comment follows a label  with  no 
  189.      semi-colon in between.  
  190.  
  191. Unknown operand
  192.  
  193.      This  error  will  occur  if  any unrecognized term is used 
  194.      where Lass is expecting an operand.  For instance: 
  195.  
  196.                   mov    byte pointer   [di],0
  197.            or     call   far   Other_Segment
  198.  
  199.  
  200.                            Chapter  VII 
  201.                           Basic  Linking
  202.  
  203.      For those of us who want the best of all  possible  worlds, 
  204. let's  complicate  a  program by turning it into a slave routine 
  205. for a Basic program.  The routine must end  with  a  far  return 
  206. (RETF) so it can be called from a Basic program and find its way 
  207. back  again.  Since  Basic  uses the same segment registers that 
  208. the routine will use,  any segment register that will be changed 
  209. by  the  routine must be carefully saved.  An example of a small 
  210. routine that whites out the screen is shown,  with the  relevant 
  211. code marked with "**".  
  212.  
  213. Video   EQU     0B000h          ;black and white screen memory
  214.                                 ;use 0B800h if you have a color card
  215. White:
  216.         PUSH    ES              ;** save ES for Basic
  217.         mov     ax,Video        ;0B00 into AX and so into
  218.         mov     es,ax           ;a segment register
  219.         mov     di,0            ;upper left corner of screen
  220.         mov     cx,2000d        ;80 * 25 spaces on screen
  221.         mov     ah,07           ;normal characters, please
  222.         mov     al,0DBh         ;solid block
  223. White_loop:
  224.         es:                     ;point to video segment
  225.         mov     [di],ax         ;it takes both AH and AL, into
  226.         inc     di              ;2 bytes, for one character
  227.         inc     di
  228.         loop    White_loop      ;subtract move just made from CX
  229.                                 ;and continue if not zero
  230.         POP     ES              ;** the original back again
  231.         RETF                    ;** a Far Return to Basic
  232.  
  233.      Write  and  save  the  routine as White.ASM and assemble it 
  234. into White.COM.  There is no easy way to prepare the routine for 
  235.  
  236. slavery,  so a few Debug tricks must be used.  If  you  are  not 
  237. used  to  Debug,  look over the G,L,N,R,M and U commands in your 
  238. manual.  Then from DOS, assuming disk drive A, type: 
  239.  
  240. A> debug whiteB.com             ;load routine along with Debug
  241. -r                              ;look at the registers.
  242.                                 ;CX register should hold 0019
  243. -m 100 119 0e00:0               ;move 19 hex bytes  (100 to 119)
  244.                                 ;to another segment (E00)
  245.  
  246. If you want to check that this is correct, type:
  247.  
  248. -u 100 119
  249.  
  250.      The mnemonics for your routine wil be displayed,  plus  one 
  251. line.  The program starts at offset 100, and 100 plus 19 adds up 
  252. to  the offset for the first byte beyond the routine.  Yes,  you 
  253. could move bytes 100 through 118 instead of 119.  But  whichever 
  254. you do,  make a note of 19, the value in the CX register, and of 
  255. E00:0, the new segment:offset address of your routine.  The next 
  256. step will be to load Basic.com into Debug,  and segment E00  was 
  257. chosen  to be just beyond Basic and yet within 64K.  If you have 
  258. the room,  5000 or 1000 or 1700 would do  as  well.  Just  don't 
  259. forget where you put it. Now load Basic.  
  260.  
  261. -n basic.com                    ;name it first
  262. -l                              ;then load it, staying in Debug
  263.  
  264.      If  you  want to make sure that your routine is still safe, 
  265. unassemble it again, but this time type: 
  266.  
  267. -u e00:0                        ;Ok?  Then proceed
  268. -g                              ;run Basic
  269.  
  270.      There will be an error message on the  screen,  but  ignore 
  271. it.  As  long  as  you see the "Ok" prompt it is all right.  Now 
  272. BSave the routine. Type below the prompt, using your notes: 
  273.  
  274. def seg=&H0E00                 ;space in "def seg" MUST be there
  275. bsave "white.bin",0,&H19       ;19 bytes at offset 0
  276.  
  277.      The .BIN extension is suggested to denote a  binary  rather 
  278. than ascii file, and one which may be called from Basic.  If you 
  279. wish,  mark  a  slave  source routine differently from your .COM 
  280. programs  to  remind  you  that  it  won't  run  from  DOS.  For 
  281. instance, you might rename White.COM  WhiteBas.COM or White.BLD.  
  282.  
  283.      Now  that  the  routine is ready to be used,  write a short 
  284. Basic program to call up the routine.  The routine is  still  in 
  285. memory right now,  but it won't stay there,  so the program must 
  286. be able to load it before calling, and it can be loaded wherever 
  287. you like.  0E00 was all right as long as there was  nothing  but 
  288. Basic.com  in  memory,  but  that spot might well be trampled on 
  289. when Basic gets  going.  If  you  have  just  64K,  the  highest 
  290. available  address  is  0000:FFFF,  or absolute 0FFFF.  Absolute 
  291. 0FFE0 would provide 20h bytes for this routine,  a bare minimum. 
  292. 0F000  would  leave 4K bytes free,  with ample space for a Basic 
  293.  
  294. program below it.  0F000 translates as 0000:F000  or  0F00:0000.  
  295. Since we want to use a zero offset,  the segment will be defined 
  296. as &H0F00.  
  297.  
  298.      The routine must be loaded with the  BLoad  command.  Don't 
  299. forget  the offset address after the file name.  Then a variable 
  300. must be used to repeat the offset for the CALL command.  
  301.  
  302. 10  REM FLASH
  303. 100 DEF SEG=&H0F00              'segment address for
  304. 110 BLOAD "White.bin",0         'mach. lang. subroutine
  305. 120 OS=0                        'offset address for routine
  306. 130 CALL OS                     'call routine at 0F000
  307. 140 FOR J=1 TO 300:NEXT J       'delay
  308. 150 CLS
  309. 160 FOR J=1 TO 300:NEXT J
  310. 170 GOTO 120                    'eternal loop
  311.  
  312.      Save the basic program by typing: save"flash.bas"
  313.  
  314.     For this short program and tiny routine you  would  have  no 
  315. trouble  if  you  tried  running  the program right now,  but in 
  316. general, you should reserve memory before entering Basic. Type: 
  317.  
  318. system                          ;exit Basic to Debug
  319. -q                              ;quit Debug
  320.  
  321.      &H0F00 is the segment address,  which translates to  offset 
  322. &HF000 within segment 0, where the Basic program will be.  Since 
  323. this is where the machine language routine will start,  subtract 
  324. one to restrict Basic  to  at  least  one  byte  below  it.  Now 
  325. reenter Basic by typing: 
  326.  
  327. >A  basic  flash/M:&HEFFF       ;enter, load, reserve memory
  328.  
  329. then let 'er rip.
  330.  
  331.      It is also possible to reserve memory space from within the 
  332. Basic  program  with  the  CLEAR statement.  At the start of the 
  333. FLASH program, add 
  334.  
  335. 20  CLEAR ,&HEFFF               'note the comma
  336.  
  337.  
  338.      May Bast guide your fingers.
  339.  
  340.          ----------------end-of-author's-documentation---------------
  341.  
  342.                         Software Library Information:
  343.  
  344.                    This disk copy provided as a service of
  345.  
  346.                         The Public (Software) Library
  347.  
  348.          We are not the authors of this program, nor are we associated
  349.          with the author in any way other than as a distributor of the
  350.          program in accordance with the author's terms of distribution.
  351.  
  352.          Please direct shareware payments and specific questions about
  353.          this program to the author of the program, whose name appears
  354.          elsewhere in  this documentation. If you have trouble getting
  355.          in touch with the author,  we will do whatever we can to help
  356.          you with your questions. All programs have been tested and do
  357.          run.  To report problems,  please use the form that is in the
  358.          file PROBLEM.DOC on many of our disks or in other written for-
  359.          mat with screen printouts, if possible.  The P(s)L cannot de-
  360.          bug programs over the telephone.
  361.  
  362.          Disks in the P(s)L are updated monthly, so if you did not get
  363.          this disk  directly from the P(s)L,  you should be aware that
  364.          the files in this set may no  longer be the current versions.
  365.  
  366.          For a copy of the latest monthly software library newsletter
  367.          and a list of the 1,900+ disks in the library, call or write
  368.  
  369.                         The Public (Software) Library
  370.                               P.O.Box 35705 - F
  371.                            Houston, TX 77235-5705
  372.                                (713) 665-7017
  373.  
  374.